package hemowork06;

public class MethodDemo {
    public static void main(String[] args) {
        say();
        sayHi("HX");
        sayHello("HX",29);
        double a=geiNum();
        System.out.println(a);
        int sum=plus(10,20);
        System.out.println(sum);

        int[] arr1=testArray(10,100);

        System.out.println("arr1数组的长度是"+arr1.length);
        int[] arr2=testArray(10,50);
        for (int i = 0; i < arr2.length; i++) {
            System.out.println(arr2[i]);
        }
        System.out.println("arr数组的最后一位数是"+arr2[arr2.length-1]);


    }

    public static void say(){
        System.out.println("大家好");
    }

    public static void sayHi(String name){
        System.out.println("大家好，我叫"+name);
    }

    public static void sayHello(String name ,int age){
        System.out.println("大家好我叫"+name+",今年"+age+"岁了");
    }

    public static double geiNum(){
        return 1.88;
    }

    public static int plus(int a,int b){
        int num =a+b;
        return num;
    }

    public static int[] testArray(int len,int max){
        int[] arr=new int[len];
        for (int i = 0; i < arr.length; i++) {
            arr[i]=(int)(Math.random()*(max+1));
        }
        return arr;
    }


}



